<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:pe="http://primefaces.org/ui/extensions">

    <h:body>
        <ui:composition template="/resources/template/template.xhtml">
            <ui:define name="content">
                <h:form>
                    <p:panel>
                        <f:facet name="header" >
                            <h:outputLabel value="Store Asset BillItems "/> 
                        </f:facet>
                        <h:panelGrid columns="2" >
                            <h:outputLabel value="From Date"/>
                            <p:calendar  id="fromDate" value="#{commonReport1.fromDate}" navigator="true" pattern="dd MMMM yyyy hh mm ss a" >      
                            </p:calendar>
                            <h:outputLabel value="To Date"/>
                            <p:calendar id="toDate" value="#{commonReport1.toDate}" navigator="true" pattern="dd MMMM yyyy hh mm ss a" >                                                                              
                            </p:calendar>
                            <h:outputLabel/>
                        </h:panelGrid>
                        <h:panelGrid columns="4" >
                            <p:spacer width="70" height="1"/>
                            <p:commandButton id="btnSearch" ajax="false" value="Search" action="#{commonReport1.createGRNBillItemForAsset()}"/>
                            <p:commandButton value="Print" ajax="false">
                                <p:printer target="billPrint"></p:printer>
                            </p:commandButton>
                            <p:commandButton value="Excel" ajax="false" action="#{commonReport1.createGRNBillItemForAsset()}" >
                                <pe:exporter type="xlsx" target="tblBills" fileName="Department_asset_by_bill_item"
                                             facetBackground="#008000" facetFontSize="15" 
                                             facetFontColor="#FFFFFF" facetFontStyle="BOLD"
                                             cellFontColor="#0000FF" cellFontSize="12" cellFontStyle="NORMAL"
                                             fontName="Courier New"></pe:exporter>
                            </p:commandButton>
                        </h:panelGrid>
                        <p:panel>
                            <h:panelGroup id="billPrint">
                                <p:dataTable rowIndexVar="i" 
                                             id="tblBills" 
                                             value="#{commonReport1.billItems}" var="bi" stickyHeader="true" editingRow="true"  >
                                    <f:facet name="header">
                                        <h:outputLabel value="Department Assets By Bill Item"/><br/>
                                        <h:outputLabel value="From :" style="white-space: pre-line"/>
                                        <h:outputLabel  value="#{commonReport1.fromDate}" >
                                            <f:convertDateTime pattern="dd MMM yyyy hh:mm:ss a"/>
                                        </h:outputLabel>
                                        <p:spacer width="10" height="0"/>
                                        <h:outputLabel value="&emsp;To :"/>
                                        <h:outputLabel  value="#{commonReport1.toDate}" >
                                            <f:convertDateTime pattern="dd MMM yyyy hh:mm:ss a"/>
                                        </h:outputLabel>
                                    </f:facet>

                                    <p:column headerText="No" styleClass="alignTop">
                                        <f:facet name="header" >
                                            <h:outputLabel value="No"/>
                                        </f:facet>
                                        <h:outputLabel value="#{i+1}"/>
                                    </p:column>
                                    <p:column headerText="Item" styleClass="alignTop">
                                        <f:facet name="header" >
                                            <h:outputLabel value="Item"/>
                                        </f:facet>
                                        <h:outputLabel value="#{bi.item.name}"/>
                                    </p:column>
                                    <p:column headerText="Suplier" styleClass="alignTop">
                                        <f:facet name="header" >
                                            <h:outputLabel value="Suplier"/>
                                        </f:facet>
                                        <h:outputLabel value="#{bi.bill.fromInstitution.name}"/>
                                    </p:column>
                                    <p:column headerText="GRN No" styleClass="alignTop">
                                        <f:facet name="header" >
                                            <h:outputLabel value="GRN No"/>
                                        </f:facet>
                                        <h:outputLabel value="#{bi.bill.deptId}"/>
                                    </p:column>
                                    <p:column headerText="Batch No" styleClass="alignTop">
                                        <f:facet name="header" >
                                            <h:outputLabel value="Batch No"/>
                                        </f:facet>
                                        <h:outputLabel value="#{bi.pharmaceuticalBillItem.itemBatch.batchNo}"/>
                                    </p:column>
                                    <p:column headerText="Qty" styleClass="averageNumericColumn">
                                        <f:facet name="header" >
                                            <h:outputLabel value="Qty"/>
                                        </f:facet>
                                        <h:outputLabel value="#{bi.pharmaceuticalBillItem.qty}"/>
                                    </p:column>
                                    <p:column headerText="Purchase Rate" styleClass="averageNumericColumn">
                                        <f:facet name="header" >
                                            <h:outputLabel value="Purchase Rate"/>
                                        </f:facet>
                                        <h:outputLabel value="#{bi.pharmaceuticalBillItem.purchaseRate}"/>
                                    </p:column>
                                    <f:facet name="footer" >
                                        <h:outputLabel value="Printed By : #{sessionController.loggedUser.webUserPerson.name}" style="float: right"/>
                                    </f:facet>
                                </p:dataTable>
                            </h:panelGroup>
                        </p:panel>
                    </p:panel>

                </h:form>
            </ui:define>


        </ui:composition>

    </h:body>
</html>
